package practice;

import java.util.Scanner;

/**
 * @author: snail_mount
 * @date: 20/1/27 23:27
 * @description: 不死神兔问题：有1对兔子，从出生的第3个月开始，每个月都生1对兔子，假如兔子都不死，问第n个月有几对兔子?
 * 1    2   3   4   5   6   7
 * 1    1   2   3   5   8   13   21
 * 1   1   2   3   5    8
 * int sum = 3(2)=2(1)+1(1)
 * 4(3)=3(2)+2(1)
 * 6(8)=5(5)+4(3)
 * 6(n)=5(n-n2)+4(n-n1)
 * fn(3)=(fn-1)(2)+(fn-2)(1)
 * fn(n)=(fn-1)(n-n2)+(fn-2)(n-n1)
 * n(5)=(n-1)(3)+(n-2)(2)
 * 2=1
 * 3=1+1
 * 4=2+1
 * 5=3+2
 * 6=5+3
 * 7=8+5
 * 1=3+2
 * fn-f(n-1)=
 * n=(x-n)+(n-2)
 * n=(x-x2)+(x-x1)
 * n=2X-x1-x2
 * fn=f(n-1)+f(n-2)
 */
public class Rabbit {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入月份");
        int j = sc.nextInt();
        int[] arr = new int[j];
        arr[0] = 1;
        arr[1] = 1;
//        arr[2] = arr[1] + arr[0];
        int i;
        for (i = 2; i < arr.length; i++) {
            arr[i] = arr[i - 2] + arr[i - 1];
        }
        System.out.println(arr[i-1]);
    }
}
